import Cookies from 'js-cookie'

export const setCookie = (name: string, value: any ,opt) => {
    Cookies.set(name, value, opt)
}
export const getCookie = (name: string, isObject = false) => {
    return isObject ? Cookies.getJSON(name) : Cookies.get(name)
}
export const delCookie = (name: string) => {
    Cookies.remove(name)
}
export const getSession = (name: string) => {
    return JSON.parse(sessionStorage.getItem(name))
}
export const setSession = (name: string, value: any) => {
    sessionStorage.setItem(name, JSON.stringify(value))
}
export const delSession = (name: string) => {
    sessionStorage.removeItem(name)
}